<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>产品列表页</title>
    <#assign path="${springMacroRequestContext.getContextPath()}" >
    <link rel="stylesheet" href="${path}/static/bootstrap-3.4.1/css/bootstrap.css" type="text/css" />
    <link rel="stylesheet" href="${path}/static/bootstrap-3.4.1/css/bootstrap-theme.css" type="text/css" />
    <link rel="stylesheet" href="https://at.alicdn.com/t/c/font_2937172_jowcw32m21j.css" />
    <script src="${path}/static/bootstrap-3.4.1/js/jquery.min.js"></script>
    <script src="${path}/static/bootstrap-3.4.1/js/bootstrap.js"></script>
    <script src="${path}/static/bootstrap-3.4.1/js/bootstrap-confirmation.min.js"></script>
</head>
<body class="container">
<p>
<div class="row">
    <div class="col-md-8">
        <#if ACCOUNT?? && ACCOUNT.userType?? && ACCOUNT.userType==1>
        <a class="btn btn-primary" target="_blank" href="${path}/prod/to_create/${type}"><#if type!=3>添加产品<#else>添加导航</#if>
        </a>
        </#if>
    </div>
    <#include "common/welcome.html" />
</div>
</p>
<div>
<ul class="nav nav-tabs">
<!--    <li role="presentation" class="active"><a href="#">产品原型</a></li>-->
<!--    <li role="presentation"><a href="${path}/to_ui">视觉交互稿</a></li>-->
<!--    <li role="presentation"><a href="${path}/to_other">其他导航</a></li>-->
    <#list prodTypeList as pType>
    <li role="presentation" <#if type==pType.id>class="active"</#if>><a href="${path}/list/${pType.id}">${pType.typeName}</a></li>
    </#list>
    <li role="presentation"><a href="${path}/prod_group/list">产品组</a></li>
    <#if ACCOUNT?? && ACCOUNT.userType?? && ACCOUNT.userType==1  >
    <li role="presentation"><a href="${path}/regist/list">注册列表</a></li>
    </#if>
</ul>

<table class="table table-bordered table-striped table-hover">
    <thead>
        <th>分组/名称</th>
        <th>访问工程名</th>
        <th>欢迎页面</th>
        <th>压缩包大小</th>
        <th>最后更新时间</th>
        <th style="text-align: center;">操作</th>
    </thead>
    <tbody>
    <#list prodGroupList as group>

        <tr id="tr_${group.id}">
            <td colspan="6"><span class="iconfont icon-xiajiantou" onclick="expand('${group.id}')" id="icon_${group.id}"></span>${group.groupName}</td>
        </tr>
        <#list  group.prodList as prod>
            <tr id="tr_${prod.id}" group-id="${group.id}">
                <td>
                    &nbsp;&nbsp;&nbsp;<#if prod.prodType==3>
                       <a target="_blank" href="${(prod.welcomeFile)!''}">${(prod.prodName)!''}</a>
                       <#else>
                       <a target="_blank" href="${visitPath}/${(prod.hostName)!''}/${(prod.welcomeFile)!''}">${(prod.prodName)!''}</a>
                     </#if>
                </td>
                <td>${(prod.hostName)!''}</td>
                <td><#if prod.prodType==3>
                    <a target="_blank" href="${(prod.welcomeFile)!''}">点击跳转</a>
                    <#else>
                    <a target="_blank" href="${visitPath}/${(prod.hostName)!''}/${(prod.welcomeFile)!''}">${(prod.welcomeFile)!''}</a>
                </#if></td>
                <td>${(prod.fileSize)!''}</td>
                <td><#if prod.updateTime??>${prod.updateTime?string("yyyy-MM-dd HH:mm:ss")}</#if></td>
                <td  style="text-align: center;width: 20%;">
                    <#if ACCOUNT?? && ACCOUNT.userType?? && ACCOUNT.userType==1  >
                        <#if prod.prodType!=3><button type="button" class="btn btn-primary btn-xs" onclick="doUpload(${prod.id},'${(prod.prodName)!''}')">上传原型</button></#if>&nbsp;&nbsp;<a target="_blank" class="btn btn-default btn-xs" href="${path}/prod/to_edit/${prod.id}">修改</a>&nbsp;&nbsp;<button class="btn btn-default btn-xs confirm-btn" data-toggle="confirmation" data-placement="bottom" attr-id="${prod.id}">删除</button>
                    </#if>
                </td>
            </tr>
        </#list>
      </#list>

    </tbody>
</table>
</div>

<#include "common/upload.html" />
<#include "common/jscommon.html" />
<script type="text/javascript">
function expand(groupId){
    var obj=$("#icon_"+groupId);
    if(obj.hasClass("icon-xiajiantou")){
        $("tr[group-id='"+groupId+"']").hide();
        obj.removeClass("icon-xiajiantou").addClass("icon-youjiantou");
    }else{
        $("tr[group-id='"+groupId+"']").show();
        obj.removeClass("icon-youjiantou").addClass("icon-xiajiantou");
    }
}
</script>
</body>
</html>